{include file="common/head" /}
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>
    {include file="common/left" /}
    <div class="main-content">
        <div class="main-content-inner">
            {include file="common/header_nav" /}
            <div class="page-content">
                <div class="page-header">
                    <h1>
                        您当前操作
                        <small>
                            <i class="ace-icon fa fa-angle-double-right"></i>
                            修改模型
                        </small>
                    </h1>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal" name="moduleUpdate" id="moduleUpdate" method="post" action="{:url('moduleUpdate')}">
                            <input type="hidden" value="1" name="type">
                            <input type="hidden" name="id" value="{$info.id}">
                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="title"> 模型名称： </label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="title" id="title" value="{$info.title}" placeholder="必填：模型名称" class="col-xs-12 col-sm-4"/>
                                    <span class="lbl">&nbsp;&nbsp;<span class="red">*</span></span>
                                </div>
                            </div>
                            <div class="space-4"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="name">模型表名： </label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="name" id="name" disabled value="{$info.name}" placeholder="必填：模型表名" class="col-xs-12 col-sm-4"/>
                                    <span class="lbl">&nbsp;&nbsp;<span class="red">*</span></span>
                                </div>
                            </div>
                            <div class="space-4"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="listfields"> 列表页调用字段： </label>
                                <div class="col-sm-10 col-xs-12">
                                    <input type="text" name="listfields" value="{$info.listfields}" id="listfields" placeholder="列表页调用字段" value="*" class="col-xs-12 col-sm-6"/>

                                </div>
                            </div>
                            <div class="space-4"></div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label no-padding-right" for="description">模型简介： </label>
                                <div class="col-sm-10 col-xs-12">
                                    <textarea id="description" name="description" placeholder="模型简介" style="padding-left: 4px;" cols="20" class="col-xs-12 col-sm-6 limitedone" maxlength="200">{$info.description}</textarea>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="clearfix form-actions">
                                <div class="col-md-offset-2 col-md-10">
                                    <button class="btn btn-info" type="submit"><i class="ace-icon fa fa-check bigger-110"></i>保存</button>
                                    &nbsp; &nbsp; &nbsp;
                                    <button class="btn" type="reset"><i class="ace-icon fa fa-undo bigger-110"></i>重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="hr hr-24"></div>

            </div>
        </div>
    </div>
    {include file="common/foot" /}
    <script>
        $(function () {
            $('#moduleUpdate').ajaxForm({
                beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
                success: complete, // 这是提交后的方法
                dataType: 'json'
            });

            function checkForm() {
                if ('' == $.trim($('#title').val())) {
                    layer.alert('模型名称不能为空',{icon:0},function(index){
                        layer.close(index);
                        $('#title').focus();
                    });
                    return false;
                }
            }

            function complete(data) {
                if (data.status == 1) {
                    layer.alert(data.info, {icon: 6}, function (index) {
                        layer.close(index);
                        window.location.href = data.url;
                    });
                } else {
                    layer.msg(data.info,{icon:5});
                    return false;
                }
            }

        });
    </script>

</div><!-- /.main-container -->
</body>
</html>
